import React from 'react'
// npm antd

class ClassDom extends React.Component{
    constructor(){
        super()
        this.get_this = this.get_this.bind(this)
    }
    //初始化函数绑定this
    get_this = function(){
        console.log(this)
    }
    getThis(){
        console.log(this)
    }
    //声明函数的时候就解决掉this指向的问题
    getMan =()=>{
        console.log(this)
    }
    render(){
        this.getThis()
        this.get_this()
        return <>
            123
            <button onClick={this.getMan}>获取</button>
            <button onClick={this.getThis.bind(this)}>getThis</button>
            <button onClick={this.get_this}>get_this</button>
        </>
    }
}
export default ClassDom